/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2013
 */

package com.smg.community.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.smg.community.model.*;
import com.smg.community.dao.*;
import com.smg.community.service.*;
import com.smg.community.setting.Cache;
import com.smg.community.setting.ProjectSetting;
import com.smg.community.vo.query.*;

/**
 * @author badqiu email:badqiu(a)gmail.com
 * @version 1.0
 * @since 1.0
 */

@Service
@Transactional
public class SmgIndexRightbottomImageManager extends BaseManager<SmgIndexRightbottomImage,java.lang.Integer>{

	private SmgIndexRightbottomImageDao smgIndexRightbottomImageDao;
	/**增加setXXXX()方法,spring就可以通过autowire自动设置对象属性,请注意大小写*/
	public void setSmgIndexRightbottomImageDao(SmgIndexRightbottomImageDao dao) {
		this.smgIndexRightbottomImageDao = dao;
	}
	public EntityDao<SmgIndexRightbottomImage,java.lang.Integer> getEntityDao() {
		return this.smgIndexRightbottomImageDao;
	}
	
	@Transactional(readOnly=true)
	public Page<SmgIndexRightbottomImage> findPage(SmgIndexRightbottomImageQuery query) {
		return smgIndexRightbottomImageDao.findPage(query);
	}
	/**
	 * 获取在线的右下角的2个广告图片
	 * 在需要的时候可以改为读取缓存,暂时是先查询数据库
	 * @return
	 */
	public List<SmgIndexRightbottomImage> getOnLineRightBottomImageList(int cityNo) {
		if ( Cache.rightbottomImageList == null ){
			Cache.rightbottomImageList  =  smgIndexRightbottomImageDao.getOnLineRightBottomImageList(cityNo);
		}
		if (ProjectSetting.USE_CACHE ){
			return Cache.rightbottomImageList ;
		}else{
			return smgIndexRightbottomImageDao.getOnLineRightBottomImageList(cityNo);
		}
	}
	/**
	 * 获取右下角的2个预览的广告图片
	 * @return
	 */
	public List<SmgIndexRightbottomImage> getPreviewRightBottomImageList(int cityNo) {
		// TODO Auto-generated method stub
		return smgIndexRightbottomImageDao.getPreviewRightBottomImageList(cityNo);
	}
	
}
